<?php

class MDPasajerosTableDraw
{

public static $instance; 

public static function getInstance()
	{
		//echo "<div id=register-box>";
        if(self::$instance==null)
		  self::$instance=new MDPasajerosTableDraw();
	//   echo "</div>";	  
		return  self::$instance;
	   
    
    }	

function DrawTable($title,$table,$growtable,$campos,$idPackTour)//obligatorio ID como campo inicial
    {
 
    
    
    $qu = "SELECT `tour_has_pasajero`.`idTourPax`,`pasajero`.`NumDocPax`,`pasajero`.`PassPax`,`pasajero`.`FirstNamPax`,`pasajero`.`LastNamPax`,`pasajero`.`MovPax`,`pasajero`.`SmkPax`,`pasajero`.`StuPax`,`tour_has_pasajero`.`tour_idTour` FROM pasajero
LEFT JOIN `viv`.`tour_has_pasajero` ON `pasajero`.`idPax` = `tour_has_pasajero`.`pasajero_idPax` 
 WHERE(( tour_idTour = $idPackTour))";   
    
    echo "<div id='content_area_user_title'>";
    echo "<h2> $title</h2>";
    echo "</div>";


    echo	"<form>";						
    echo "<form id='filter-form'>Buscar pasajeros: <input name='filter' id='filter' value='' maxlength='30' size='30' type='text'></form><br>";
    echo "</form>";
   
    echo "<div class='usersettings_statistics'>"; 
 


    echo "<table class='food_planner'>";
    
    echo "<thead>";
    echo "<tr>";    
        foreach($campos as $id=>$valor){
                echo "<th>$valor</th>";
                }
    echo "</tr>";    
    echo "</thead>";
    
    echo "<tbody><tr style='display: table-row;'>";

     //echo "<table> <tbody>";


  

 echo "<tr class='odd'>";
  
    
    // $qu="select*from $table";
    $table=CModelo::getInstance()->getData($qu);
//var_dump($table);
    $cont=0;
    $ruta=CConfig::getInstance()->rutalocal."/MDTourGeneral/MDPasajeros";
    
    
    foreach($table as $campo => $valor)
    { 



$cont=$cont+1;
if($cont%2){




echo "<tr class='odd'>";
$i="";$cont=0;
foreach($valor as $id=>$val)
{ if($cont==0){$i=$val;}

echo "<td width='10%'>$val</td>";$cont=$cont+1;
}
/*---------------------------------------------------------------------------*/
// las referencias debbden de ser modificadas deacuerdo al directorio
//
/*---------------------------------------------------------------------------*/

echo "<td> <input type=button onClick=\"parent.location='../../MDItinerary/MDEItinerary.php?codigo=$idPackTour&pax=$i'\" value='Itinerario'>  </td>";
echo "<td> <a href='$ruta/CPaxEdit.php?codigo=$i&action=1'> <img src='../../images/edit.png' width='32' title='Editar pasajero $i'/></a> </td>";
echo "<td> <input type='image' src='' onclick='confirm_del($i)' value='Terminar registro'> </td>";

echo "</tr>";
}
else
{

echo "<tr class='even'> ";
$i2="";$cont2=0;
foreach($valor as $id => $val)
{ if($cont2==0){$i2=$val;}
echo "<td width='10%'>$val </td>";$cont2=$cont2+1;
}
echo "<td> <input type=button onClick=\"parent.location='../../MDItinerary/MDEItinerary.php?codigo=$idPackTour&pax=$i2'\" value='Itinerario'>  </td>";
echo "<td> <a href='$ruta/CPaxEdit.php?codigo=$i2&action=1'> <img src='../../images/edit.png' width='32' title='Editar pasajero $i2'/></a> </td>";
echo "<td> <input type='image' src='' onclick='confirm_del($i2)' value='Terminar registro'> </td>";
echo "</tr>";
}

}
echo "</td></tr></tbody></table><br><br>";


echo "</div>";

} 



}
?>